<table class="tbl-list" width="100%" cellpadding="0" cellspacing="0" border="1" id="table">
    <thead>
		<tr>
			<th class="td-label bold text-center ver-middle" width="25" style="padding: 5px 0;">
				<span><?php echo $archive_lang['#'];?></span>
			</th>
			
			<th class="td-label bold text-center ver-middle" width="50" style="padding: 5px 0;">
				<span><?php echo $archive_lang['preview'];?></span>
			</th>
						
			<th class="td-label bold text-center ver-middle" width="155" style="padding: 5px 0;">
                <p class="ver-middle" style="height:33px;line-height: 33px;"><?php echo $archive_lang['ad'];?></p>
			</th>
			
			<th class="td-label bold text-center ver-middle" width="43" style="padding: 5px 0;">
				<span><?php echo $archive_lang['status'];?></span>
			</th>
			
            <th class="td-label bold text-center ver-middle" width="64" style="padding: 5px 0;">
				Vùng miền								
			</th>
            
			<th class="td-label bold text-center ver-middle {sorter: 'fancyNumber'}" width="49" style="padding: 5px 0;">
				<p class="ver-middle" style="height:33px;line-height: 33px;">Click</p>
			</th>
			
			<th class="td-label bold text-center ver-middle {sorter: 'fancyNumber'}" width="76" style="padding: 5px 0;">
				<p class="ver-middle" style="height:33px;line-height: 33px;"><?php echo $archive_lang['impressions'];?></p>
			</th>
			
			<th class="td-label bold text-center ver-middle {sorter: 'fancyNumber'}" width="70" style="padding: 5px 0;">
				<p class="ver-middle" style="height:33px;line-height: 33px;"><?php echo $archive_lang['uv'];?></p>
			</th>
			
			<th class="td-label bold text-center ver-middle" width="55" style="padding: 5px 0;">
				<p class="ver-middle" style="height:33px;line-height: 33px;">CTR %</p>
			</th>
		</tr>
    </thead>
    <tbody>
    	<?php $index=1+($page-1)*$numrow;
        foreach($info as $if)
        {
        ?>
    	<tr>
    		<td class="ver-middle">
    			<p class="db-list-cl-stt">
    				<?php echo $index;?>
    			</p>
    		</td>
    		
    		<td class="ver-middle">
            	<p class="db-list-cl-img">
                    <a onclick="ajax_tooltip(<?php echo $if['bannerid']?>,this,<?php echo $index;?>,<?php echo $if['status'];?>);">
				        <img alt="" src="<?php echo $if['filepath'];?>" width="40" height="40"/>
                    </a>
				</p>
			</td>
    		
    		<td class="ver-middle">
    			<div class="db-list-cl-banner">
    				<p >
                        <a href="<?php echo site_url('bannerdetail/index?bannerid='.$if['bannerid'].'&fromdate='.$fromdate.'&todate='.$todate)?>">
    					   <?php echo $if['bannername'];?>
                        </a>
    				</p>
    				<p class="text-999">
                        <a href="<?php echo site_url('campaigndetail/index?campaignid='.$if['campaignid'].'&fromdate='.$fromdate.'&todate='.$todate)?>">
    					   <?php echo $if['campaignname'];?>
                        </a>
    				</p>
    			</div>
    		</td>
    		
    		<td class="ver-middle text-center">
    			<p class="edit3">
                    <input type="hidden" value="<?php echo site_url('banner/edit') . '?bannerid='. $if['bannerid'].'&type=1';?>" class="hddEditLink"/>
    				<?php //echo $if['status'];
                    if($if['outofstore']==1)
                        echo '<img class="cursor-pointer" alt="" src="images/dealed.png" title="'.$archive_lang['dealed'].'"/>';
                    elseif($if['status']==-1)
                        echo '<img class="cursor-pointer" alt="" src="images/imgok.gif" title="'.$archive_lang['completed'].'"/>';
                    elseif($if['status']==0)
                        echo '<img class="cursor-pointer" alt="" src="images/temp_deleted.gif" title="'.$archive_lang['temp_deleted'].'"/>';
                    elseif($if['status']==1)
                        echo '<img class="cursor-pointer" alt="" src="images/imgrun.gif" title="'.$archive_lang['running'].'"/>';
                    elseif($if['status']==2)
                        echo '<img class="cursor-pointer" alt="" src="images/imgpause.gif" title="'.$archive_lang['paused'].'"/>';
                    elseif($if['status']==3)
                        echo '<img class="cursor-pointer" alt="" src="images/imgwait.png" title="'.$archive_lang['waiting'].'"/>';
                    elseif($if['status']==4)
                        echo '<img class="cursor-pointer" alt="" src="images/imgproblem.png" title="'.$archive_lang['problem'].'"/>';
                    elseif($if['status']==5)
                        echo '<img class="cursor-pointer" alt="" src="images/imgout-of-money.png" title="'.$archive_lang['outofmoney'].'"/>';
                    elseif($if['status']==6)
                        echo '<img class="cursor-pointer" alt="" src="images/het_ngan_sach.gif" title="'.$archive_lang['het_ngan_sach'].'"/>';
                    else
                        echo $if['status'];
                    ?>
    			</p>
    		</td>
            
            <td class="ver-middle">
				<p class="pad5">
					<?php $mystring =$if['locationAd'];
                    if(strpos($mystring,'0')!==false) {
                         $mystring = str_replace("0","Toàn quốc",$mystring);
                    }
                    if(strpos($mystring,'1')!==false) {
                         $mystring = str_replace("1","Bắc",$mystring);
                    }
                    if(strpos($mystring,'2')!==false) {
                         $mystring = str_replace("2","Trung",$mystring);
                    }
                    if(strpos($mystring,'3')!==false) {
                         $mystring = str_replace("3","Nam",$mystring);
                    }
                    echo rtrim($mystring,',');
                     ?>
				</p>	
			</td>
            
    		<td class="ver-middle">
				<div class="db-list-cl-click">
					<p>
    					<a <?php echo ($if['clicks']!= 'N/A') ? 'onclick="ajax_tooltip2('.$if['bannerid'].',this,0,'.$if['status'].')"' : '' ;?> ><?php echo $if['clicks'];?></a>
    				</p>
				</div>
			</td>
    		
    		<td class="ver-middle">
    			<div class="db-list-cl-imp">
    				<p>
    					<a <?php echo ($if['clicks']!= 'N/A') ? 'onclick="ajax_tooltip2('.$if['bannerid'].',this,1,'.$if['status'].')"' : '' ;?> ><?php echo $if['impressions'];?></a>
    				</p>
    			</div>
    		</td>
    		
    		<td class="ver-middle">
    			<div class="db-list-cl-uv">
    				<p>
    					<?php echo $if['uviews']==0 ? 'N/A':$if['uviews'];?>
    				</p>
    			</div>
    		</td>
    		
    		<td class="ver-middle">
    			<div class="db-list-cl-ctr">
    				<p>
    					<?php echo $if['CTR'];?>
    				</p>
    			</div>
                <input type="hidden" class="abcdef" value="<?php echo $if['bannerid']; ?>" />
    		</td>
    	</tr>
    	<?php
        $index++;
        }
        ?>
    </tbody>
</table>
<div id="pager" style="font-family: tahoma;border: solid 1px #D6D6D6;float: right; margin-top: 10px;background-color: white;padding:3px 10px 4px;">
<table cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td class="ver-middle">
            <span class="ver-middle"><?php echo $archive_lang['page'];?></span>
            <input readonly="readonly" type="text" id="pagedisplay" class="pagedisplay ver-middle" size="2" style="border:0;" value="<?php echo $page.'/'.$totalpage;?>"/>
        </td>
        <td class="ver-middle" style="padding-bottom: 2px;">
            <img src="/images/imgpre.gif" class="prev ver-middle" id="prev" <?php echo ($page>1)? 'onclick="prev_page_ajax();"':'';?>/>
            <img src="/images/imgnext.gif" class="next ver-middle" id="next" <?php echo ($page<$totalpage)? 'onclick="next_page_ajax();"':'';?>/>
        </td>
        <td style="padding-top: 2px;">
            <select class="pagesize ver-middle" style="border: 0;background: #fff;" id="pagesize" onchange="pagesize1()">
    			<option value="10" <?php echo ($numrow==10) ? 'selected="selected"':'' ;?>>10</option>
    			<option value="20" <?php echo ($numrow==20) ? 'selected="selected"':'' ;?>>20</option>
    			<option value="30" <?php echo ($numrow==30) ? 'selected="selected"':'' ;?>>30</option>
    			<option value="40" <?php echo ($numrow==40) ? 'selected="selected"':'' ;?>>40</option>
    		</select>
        </td>
    </tr>
</table>       
</div>
<style type="text/css">
.tbl-noborder td{
    height:21px;
}
</style>
<script type="text/javascript">
    function next_page_ajax()
    {
        if(<?php echo $page?> >= <?php echo $totalpage?>)
        {
            var page =<?php echo $totalpage;?>;
        }else{
            var page = <?php echo $page?>+1; 
        }
        var numrow = $('#pagesize').val();
        var arrTime = $('#date').val().toString().split(' <?php echo $archive_lang['to'];?> ');
        var fromdate = arrTime[0];
        var todate = arrTime[1];
        fromdate=fromdate.split('/');
        fromdate=fromdate[2]+'-'+fromdate[1]+'-'+fromdate[0];
        todate=todate.split('/');
        todate=todate[2]+'-'+todate[1]+'-'+todate[0];
        var strURL="<?php echo site_url('archive/filter?');?>&fromdate="+fromdate+"&todate="+todate+'&page='+page+'&numrow='+numrow;
        var success = function(data)
        {
        	$('#campaigndiv').html(data);
        	$('#loading').hide();
        };
    	$('#loading').show();
        getAjax(strURL,"",'', '', '', false, success);
    }
    function prev_page_ajax()
    {
        if(<?php echo $page?>==1)
        {
            var page =1;
        }else{
            var page = <?php echo $page?>-1; 
        }
        var numrow = $('#pagesize').val();
        var arrTime = $('#date').val().toString().split(' <?php echo $archive_lang['to'];?> ');
        var fromdate = arrTime[0];
        var todate = arrTime[1];
        fromdate=fromdate.split('/');
        fromdate=fromdate[2]+'-'+fromdate[1]+'-'+fromdate[0];
        todate=todate.split('/');
        todate=todate[2]+'-'+todate[1]+'-'+todate[0];
        var strURL="<?php echo site_url('archive/filter?');?>&fromdate="+fromdate+"&todate="+todate+'&page='+page+'&numrow='+numrow;
        var success = function(data)
        {
        	$('#campaigndiv').html(data);
        	$('#loading').hide();
        };
    	$('#loading').show();
        getAjax(strURL,"",'', '', '', false, success);
    }
    <?php if(count($info)>0){ ?>
	$(function() {        
	  $(".edit3").editable('',{ 
	    data   : "{'4':'<?php echo $archive_lang['restore'];?>'}",
	    type:"select",
	    submit : 'OK',
	    indicator : 'Wait...',
	    id : 'hk',
	    name : 'ns',
        typeEdit:true,
	    css : 'inherit',
	    cssclass : "editable",
	    onblur    : "cancel"
	  });  
	});
    <?php } ?>
</script>